const express = require('express')
const path = require('path')
const bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.urlencoded({extended:false}))
app.use(bodyParser.json())
// 使用中间件 提供public公共资源
app.use('/static',express.static(path.join(__dirname,'/public')))
app.post('/user/register',(req,res)=>{
    console.log(req)
    res.send('注册成功')
})
let server = app.listen(3000,'127.0.0.1',()=>{
     host = server.address().address;
    let port = server.address().port;
    console.log(`app listening ${host} onport ${port}`)
})